﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace MessageRouter.ServiceBroker.Configuration
{
    [ConfigurationCollection(typeof(ServiceBrokerBehaviorConfigurationElement), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
    internal sealed class ServiceBrokerBehaviorConfigurationElementCollection : ConfigurationElementCollection
    {
        private static readonly ConfigurationPropertyCollection properties;

        internal ServiceBrokerBehaviorConfigurationElement this[int index]
        {
            get { return (ServiceBrokerBehaviorConfigurationElement)BaseGet(index); }
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get { return properties; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ServiceBrokerBehaviorConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((ServiceBrokerBehaviorConfigurationElement)element).Name;
        }

        static ServiceBrokerBehaviorConfigurationElementCollection()
        {
            properties = new ConfigurationPropertyCollection();
        }
    }
}
